package com.tianhe.perimeter.generator.controller;

import com.tianhe.perimeter.generator.common.utils.PageUtils;
import com.tianhe.perimeter.generator.common.utils.R;
import com.tianhe.perimeter.generator.entity.AlmPerimeterEventEntity;
import com.tianhe.perimeter.generator.service.AlmPerimeterEventService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 
 *
 * @author dmm
 * @email sunlightcs@gmail.com
 * @date 2019-12-09 13:31:12
 */
@RestController
@RequestMapping("generator/almperimeterevent")
public class AlmPerimeterEventController {
    @Autowired
    private AlmPerimeterEventService almPerimeterEventService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = almPerimeterEventService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{utc}")
    public R info(@PathVariable("utc") Integer utc){
		AlmPerimeterEventEntity almPerimeterEvent = almPerimeterEventService.getById(utc);

        return R.ok().put("almPerimeterEvent", almPerimeterEvent);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody AlmPerimeterEventEntity almPerimeterEvent){
		almPerimeterEventService.save(almPerimeterEvent);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")

    public R update(@RequestBody AlmPerimeterEventEntity almPerimeterEvent){
		almPerimeterEventService.updateById(almPerimeterEvent);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] utcs){
		almPerimeterEventService.removeByIds(Arrays.asList(utcs));

        return R.ok();
    }

}
